<template>
	<body>
		<div class="loan_nav col_nav">
			<ul>
				<li><a href="javascript:history.go(-1)"><i class="iconfont">&#xe61e;</i></a></li>
				<li><p>提现到银行卡</p></li>
				<li></li>
			</ul>
		</div>
		<div class="interval_T">
			
		</div>
		<div class="withdrawals_form">
			<ul>
				<li><p>姓名</p></li>
				<li><input type="text" v-model="bankCard.userName" readonly/></li>
			</ul>
		</div>
		<div class="withdrawals_form">
			<ul>
				<li><p>银行</p></li>
				<li><input type="text" v-model="bankCard.bankName" readonly/></li>
			</ul>
		</div>
		<div class="withdrawals_form">
			<ul>
				<li><p>卡号</p></li>
				<li><input type="text" v-model="bankCard.bankCardNo" readonly /></li>
			</ul>
		</div>
		<div class="crude_line"></div>
		<div class="withdrawals_form">
			<ul>
				<li><p>金额</p></li>
				<li><input v-model="params.amount" type="tel" placeholder="请输入提现金额" /></li>
			</ul>
		</div>
		<div class="btn">
			<input @click="withdraw" type="button" value="立即申请" class="col-green" />
		</div>
	</body>
</template>

<script>
export default {
	data() {
		return {
			bankCard: {},
			params: {}
		}
	},
	created() {
		this.query()
	},
	methods: {
		query() {
			this.$http.get('/app/bankcard/info').then(json => {
				const { code, bankCard } = json
				if(code === 0) {
					this.bankCard = bankCard
					this.params = { ...this.params, bankCardId: bankCard.bankCardId, bankCardNo: bankCard.bankCardNo }
				}
			})
		},
		withdraw() {
			this.$http.post('/app/withdraw/withdraw/' + this.$route.params.type, this.params).then(json => {
				const { code } = json
				if(code === 0) {
					this.$vux.toast.show({ text: '申请成功' })
					if(this.$route.params.type == '2') {
						this.$router.replace('/iShare')
					} else {
						this.$router.back()
					}
					
				}
			})
		}
	}
}
</script>

<style>
</style>